<?
        // Menu tipo HOME
        $aColor = traer_colores();
                        
        $nqColumnas = $this->aDatos[$cTemplateId][nqColumnas];
        if ( $nqColumnas == '' ) $nqColumnas = 3;
        $nAncho = 184*$nqColumnas;
        $nCont = 1;
        $oMenu = new Menu('body_main', 'menuhome', 'menu', $this->aDatos[$cTemplateId][bSeleccion] );
        $cCamino = $this->oDatabase->getData( "SELECT cCamino FROM gtMenu WHERE ncMenu = " . $this->aDatos[$cTemplateId][ncMenu] );
        $cFiltro = " cCamino like '" . $cCamino . $this->aDatos[$cTemplateId][ncMenu] .".%'  AND ncEstadoPublicacion IN (2,5) " ;
        if ( $this->aDatos[$cTemplateId][cFiltro] ) $cFiltro .= " AND " . $this->aDatos[$cTemplateId][cFiltro];
        armarMenuSimple ( $this->oDatabase, $oMenu, $this->aDatos[$cTemplateId][ncMenu] , $this->getLanguage(), $this->aDatos[$cTemplateId][nExpandido] , $cFiltro);
        
        // titulo 
        $cSql = "SELECT ncMenu, cdMenu, cUrl, nModo, bExpandido, cDescripcion FROM gtMenu WHERE ncMenu=  " . $this->aDatos[$cTemplateId][ncMenu];
        $aMenu = $this->oDatabase->getMatrix($cSql);
        
echo "<div>";
echo MarkDown(extractLanguage($aMenu[0][cDescripcion], $lang));
echo "<ul class='menuhome' style='width: ".$nAncho."px;'>";

        /// Principio
        $cUrlBase = replaceString( $oMenu->cKeyName, '', getThisUrl() );
        /// Recorre el los items
        foreach ( $oMenu->aMenu as $ncMenu => $oItem )
        {
                $cPath = $oItem[10] != '' ? $oItem[10]: $cParentPath . $nIndex . '.' ;
                $cHRef = "javascript:void(0);";
                $cOnClick = "";
                // Si esta seleccionado => usa la class seleccio
                $cClass = ($oMenu->bMuestraSelector && $oMenu->cSelected == $cPath ) ? $oMenu->cStyleSelected :'';
                // Si es un grupo de items  o muestra el menu seleccionado => Pone hace un refresh del menu
                if ( $oMenu->cClassContainer && $oMenu->cUrlRefresh && ($oItem[6] || $oMenu->bMuestraSelector) )
                {
                        $cUrl = $oMenu->cUrlRefresh . '&amp;' . $oMenu->cKeyName . '=' . $cPath;
                        $cOnClick = "send(\"$cUrl\",refreshElement, \"" . $oMenu->cClassContainer . "\", false ); ";
                }
                //Si tiene una URL y tiene acceso => lo agrega al HRef
                if ( $oItem[2]  )
                {
                        $cTarget = $oItem[3] ? $oItem[3] : $oMenu->cTarget;
                        $cUrl = $oItem[2];
                        if ( $oItem[9]  ) 
                          $nTipo = $oItem[9] ;
                        else
                        {
                          $nTipo = 4;
                          if ( $cTarget == 'div_popup' ) $nTipo = 2;
                          elseif ( substr($cTarget, 0, 7)  == 'iframe_'  )  $nTipo = 3;
                          elseif ( substr($oItem[2], 0, 7)  == 'http://'  ) $nTipo = 4;
                          //elseif ( defined(MODO_ADMIN) &&  MODO_ADMIN ) $nTipo = 1;
                        }
                        switch( $nTipo )
                        {
                          case 1: // Ajax
                                $cUrl .=  '&amp;' . PARAM_TARGET . '=' . $cTarget. '&amp;' . $oMenu->cKeyName . '=' . $cPath;
                                $cOnClick .= "send(\"$cUrl\",refreshElement, \"" . $cTarget . "\", true, true, \"". $oItem[1] ."\"  ); return false;";break;
                          case 2:  // Popup
                                $cOnClick = "openPopup( \"$cUrl\" ,\" \", 600, 500 ); "; break;
                          case 3: // IFrame
                                $cUrl .=  '&amp;' . PARAM_TARGET . '=' . $cTarget. '&amp;' . $oMenu->cKeyName . '=' . $cPath;
                                $cOnClick =  "oF = document.getElementById( \"iframe_body_main\"); oF.src=\"$cUrl\"; return false; ";break;
                          case 4: //
                                $cHRef = replaceString( PARAM_REFRESH, '', $cUrl  );
                                if ( substr($cUrl, 0, 7)  == 'http://'   )    $cHRef .= "' target='_blank";                                
                                break;
                        }
                }
                if ( $cOnClick ) $cOnClick = "onclick='$cOnClick '  " ;
                
                if ( $oItem[1] == 'vacio' )
                    echo "<li  ". $oItem[8] . " style='height:260px; border-top: 3px solid #".$aColor[$nCont]."".($oItem[7] ? "; " . $oItem[7] : '') ."' >&nbsp;</li>";
                else
                    echo "  <li  ". $oItem[8] . " style='border-top: 3px solid #".$aColor[$nCont]."".($oItem[7] ? "; " . $oItem[7] : '') ."' >
                                        <div class='titulo'>" . $oItem[1] . "</div>
                                        <div><a  $cClass href='$cHRef' $cOnClick ><img src='".URL_FILES."imagenes_menu/$ncMenu.jpg' width='175' height='145' style='border:none' alt='" . $oItem[1] . "'/></a></div>
                                        <div style='margin-top:5px; height:50px'><a  $cClass href='$cHRef' $cOnClick >" . $oItem[4] . "</a></div>
                                </li>";
                $nCont++;
        }
        for ( $i=1; $i<=$nqColumnas; $i++ )
                echo "  <li style='height:10px; border-top: 3px solid #".$aColor[$i]."' > </li>";
        

echo "</ul>";
echo "</div>";
?>